package com.ffdms.vo;

import android.database.Cursor;

public class PlanInfo {
	public static final String TABLENAME = "PLANINFO";
	public static final String COLUMN_ID = "ID";
	public static final String COLUMN_NAME = "NAME";
	public static final String COLUMN_PLANTYPEID = "PLANTYPEID";
	public static final String COLUMN_BEGINTIME = "BEGINTIME";
	public static final String COLUMN_ENDTIME = "ENDTIME";
	public static final String COLUMN_SETTIME = "SETTIME";
	public static final String COLUMN_DEPARTMENTID = "ID";
	public static final String COLUMN_STAFFID = "STAFFID";
	public static final String COLUMN_DESCRIPTION = "DESCRIPTION";
	public static final String COLUMN_STATUS = "STATUS";
	public static final String COLUMN_PLANCUSTOMTYPEID = "PLANCUSTOMTYPEID";
	public static final String COLUMN_VERSION = "VERSION";
	public static final String COLUMN_ATTACHMENT = "ATTACHMENT";
	public static final String COLUMN_ENTERPRISEID = "ENTERPRISEID";
	public static final String COLUMN_ADDTIME = "ADDTIME";
	public static final String COLUMN_MODIFYTIME = "MODIFYTIME";
	public static final String[] ALLCOLUMNS = new String[] { COLUMN_ID,
			COLUMN_NAME, COLUMN_PLANTYPEID, COLUMN_BEGINTIME, COLUMN_ENDTIME,
			COLUMN_SETTIME, COLUMN_DEPARTMENTID, COLUMN_STAFFID,
			COLUMN_DESCRIPTION, COLUMN_STATUS, COLUMN_PLANCUSTOMTYPEID,
			COLUMN_VERSION, COLUMN_ATTACHMENT, COLUMN_ENTERPRISEID,
			COLUMN_ADDTIME, COLUMN_MODIFYTIME };
	public static final String CREATE_TABLE_SQL = String.format(
			"CREATE TABLE %s(" + "%s INTEGER PRIMARY KEY AUTOINCREMENT,"
					+ "%s TEXT NULL,"
					+ "%s INTEGER NOT NULL,"
					+ "%s TEXT NULL," 
					+ "%s TEXT NULL," 
					+ "%s TEXT NULL," 
					+ "%s INTEGER NULL,"
					+ "%s INTEGER NOT NULL,"
					+ "%s TEXT NULL," 
					+ "%s INTEGER NOT NULL,"
					+ "%s INTEGER NOT NULL,"
					+ "%s TEXT NULL,"
					+ "%s BLOB NULL,"
					+ "%s INTEGER NOT NULL,"
					+ "%s TEXT NULL,"
					+ "%s TEXT NULL)", TABLENAME, COLUMN_ID,
					COLUMN_NAME, COLUMN_PLANTYPEID, COLUMN_BEGINTIME, COLUMN_ENDTIME,
					COLUMN_SETTIME, COLUMN_DEPARTMENTID, COLUMN_STAFFID,
					COLUMN_DESCRIPTION, COLUMN_STATUS, COLUMN_PLANCUSTOMTYPEID,
					COLUMN_VERSION, COLUMN_ATTACHMENT, COLUMN_ENTERPRISEID,
					COLUMN_ADDTIME, COLUMN_MODIFYTIME);

	private int iD;
	private String name;
	private int planTypeID;
	private String beginTime;
	private String endTime;
	private String setTime;
	private int departmentID;
	private int staffID;
	private String description;
	private int status;
	private int planCustomTypeID;
	private String version;
	private byte[] attachment;
	private int enterpriseID;
	private String addTime;
	private String modifyTime;

	public int getiD() {
		return iD;
	}

	public void setiD(int iD) {
		this.iD = iD;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getPlanTypeID() {
		return planTypeID;
	}

	public void setPlanTypeID(int planTypeID) {
		this.planTypeID = planTypeID;
	}

	public String getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(String beginTime) {
		this.beginTime = beginTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getSetTime() {
		return setTime;
	}

	public void setSetTime(String setTime) {
		this.setTime = setTime;
	}

	public int getDepartmentID() {
		return departmentID;
	}

	public void setDepartmentID(int departmentID) {
		this.departmentID = departmentID;
	}

	public int getStaffID() {
		return staffID;
	}

	public void setStaffID(int staffID) {
		this.staffID = staffID;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public int getPlanCustomTypeID() {
		return planCustomTypeID;
	}

	public void setPlanCustomTypeID(int planCustomTypeID) {
		this.planCustomTypeID = planCustomTypeID;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public byte[] getAttachment() {
		return attachment;
	}

	public void setAttachment(byte[] attachment) {
		this.attachment = attachment;
	}

	public int getEnterpriseID() {
		return enterpriseID;
	}

	public void setEnterpriseID(int enterpriseID) {
		this.enterpriseID = enterpriseID;
	}

	public String getAddTime() {
		return addTime;
	}

	public void setAddTime(String addTime) {
		this.addTime = addTime;
	}

	public String getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(String modifyTime) {
		this.modifyTime = modifyTime;
	}
	
	public PlanInfo valueOf(Cursor c){
		this.iD = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_ID));
		this.name = c.getString(c.getColumnIndex(PlanInfo.COLUMN_NAME));
		this.planTypeID = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_PLANTYPEID ));
		this.beginTime = c.getString(c.getColumnIndex(PlanInfo.COLUMN_BEGINTIME ));
		this.endTime = c.getString(c.getColumnIndex(PlanInfo.COLUMN_ENDTIME ));
		this.setTime = c.getString(c.getColumnIndex(PlanInfo.COLUMN_SETTIME));
		this.departmentID = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_DEPARTMENTID));
		this.staffID = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_STAFFID ));
		this.description = c.getString(c.getColumnIndex(PlanInfo.COLUMN_DESCRIPTION ));
		this.status = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_STATUS ));
		this.planCustomTypeID = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_PLANCUSTOMTYPEID ));
		this.version = c.getString(c.getColumnIndex(PlanInfo.COLUMN_VERSION ));
		this.attachment = c.getBlob(c.getColumnIndex(PlanInfo.COLUMN_ATTACHMENT ));
		this.enterpriseID = c.getInt(c.getColumnIndex(PlanInfo.COLUMN_ENTERPRISEID));
		this.addTime = c.getString(c.getColumnIndex(PlanInfo.COLUMN_ADDTIME ));
		this.modifyTime = c.getString(c.getColumnIndex(PlanInfo.COLUMN_MODIFYTIME ));
		return this;
	}
}
